<template>
  <div>
       <!-- 面包屑 -->
    <v-branch></v-branch>
    <!-- 添加按钮 -->
    <div>
      <el-button class="btn" @click="add" type="primary" plain size="small" 
        >添加</el-button>
    </div>
    <v-list @edit='edit'></v-list>
    <v-dialog ref="dialogInfo" :isadd='isadd' :isshow='isshow' @cancel='cancel' ></v-dialog>
    <!--  -->
  </div>
</template>

<script>
import vList from './list.vue'
import vDialog from './dialog.vue'
export default {
  data() {
    return {
      isshow:false,
      //判断弹窗是添加还是编辑
      isadd:true
    };
  },
  components:{
      vList,
     vDialog
  },
  methods:{
    add(){
      this.isshow=true
      //告诉弹框是添加
      this.isadd=true
    },
    cancel(e){
   this.isshow=e
    },
    //封装打开编辑框事件
    edit(e){
      this.isshow=true;
      this.isadd=false
      //e为数据列表的id
 this.$refs.dialogInfo.lookup(e)
    }
  }
};
</script>

<style scoped>
.btn {
  margin: 10px;
}
</style>
